package com.ten.teacher.contorller;

import com.ten.common.core.entity.EduTeacher;
import com.ten.common.core.vo.Result;
import com.ten.teacher.service.AttentionTeacherService;
import com.ten.teacher.service.EduTeacherService;
import com.ten.teacher.vo.GuanZhuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ：Wqw
 * @date ：Created in 2022/12/28 22:43
 * @description：我的关注
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("core/shoucangTeacher")
@Api(tags = "我的关注API接口类")
public class AttentionTeacherController {
    @Autowired
    private AttentionTeacherService attentionTeacherService;

    /**
     * 查询关注的所有老师信息
     */
    @ApiOperation(value = "关注讲师的信息")
    @ApiImplicitParam(name="memberId",value = "会员id")
    @PostMapping("/findAttentionTeacherById/{memberId}")
    public Result<EduTeacher> findAttentionTeacherById(@PathVariable String memberId) {
        return attentionTeacherService.findAllByMemberId(memberId);
    }

    /**
     * 取消关注,通过对应讲师id
     */
    @ApiOperation(value = "取消关注")
    @PostMapping("/deleteAttentionTeacher")
    public Result deleteAttentionTeacher(@RequestBody GuanZhuVo guanZhuVo) {
        return attentionTeacherService.deleteAttentionById(guanZhuVo);
    }

    /**点开课程查询是否关注该老师
     * 从而显示 已关注 未关注*/
    @ApiOperation(value = "在课程里显示已关注的老师")
    @PostMapping("/findAttentionTeacher")
    public Result findAttentionTeacher(@RequestBody GuanZhuVo guanZhuVo){
        return attentionTeacherService.findTeacherByStatus(guanZhuVo);
    }

    /**点开课程
     * 点击未关注关注该讲师*/
    @PostMapping("/addAttentionTeacher")
    public Result addAttentionTeacher(@RequestBody GuanZhuVo guanZhuVo){
        return attentionTeacherService.insertAttentionTeacherByMemberId(guanZhuVo);
    }
}
